
package com.e885.sample.view.bean;

import java.util.Date;

import com.e885.util.date.DateStringUtil;
import com.e885.util.date.TWFormatStyle;

/**
 * PersonInfo bean.
 * 
 * @author Eric.Kao gau168.gau@msa.hinet.net
 * @version 1.0
 * @company E885 Group
 * @copyright Copyright (c) 2001-2008
 */

public class PersonInfoBean implements java.io.Serializable
{
	/**
	 * 姓別: 男性
	 */
	public static String SEX_MALE = "M";

	/**
	 * 姓別: 女生
	 */
	public static String SEX_FEMAIL = "F";

	private static final long serialVersionUID = -3042250624430518499L;

	/**
	 * uuid
	 */
	private String id;

	/**
	 * 行政區或鄉鎮市
	 */
	private DistrictBean districtBean;

	/**
	 * 身份證字號
	 */
	private String identity;

	/**
	 * 姓名
	 */
	private String name;

	/**
	 * 性別
	 */
	private String sex;

	/**
	 * 出生年月日
	 */
	private Date birthDate;

	/**
	 * 地址, 不包含縣市和鄉鎮市(或行政區)
	 */
	private String address;

	/**
	 * default constructor
	 */
	public PersonInfoBean()
	{
	}

	/**
	 * 取得 person info uuid
	 * 
	 * @return
	 */
	public String fetchId()
	{
		if( id == null )
			return "";

		return id;
	}

	/**
	 * 取得身份證字號
	 * 
	 * @return
	 */
	public String fetchIdentity()
	{
		if( identity == null )
			return "";

		return identity;
	}

	/**
	 * 取得姓名
	 * 
	 * @return
	 */
	public String fetchName()
	{
		if( name == null )
			return "";

		return name;
	}

	/**
	 * 取得性別, "男"或"女"
	 * 
	 * @return
	 */
	public String fetchSexString()
	{
		if( sex == null )
			return "";

		if( sex.equals( SEX_MALE ) )
			return "男";
		else if( sex.equals( SEX_FEMAIL ) )
			return "女";
		else
			return "";
	}

	/**
	 * 取得出生日期, 格式為 63/02/01
	 * 
	 * @return
	 */
	public String fetchBirthDateString()
	{
		return DateStringUtil.transDate2String( birthDate, TWFormatStyle.SLASH_HALF_NUMBER_FORMAT_STYLE );
	}

	/**
	 * 取得地址
	 * 
	 * @return
	 */
	public String fetchAddress()
	{
		if( address == null )
			return "";

		return address;
	}

	public String getAddress()
	{
		return this.address;
	}

	public Date getBirthDate()
	{
		return this.birthDate;
	}

	public DistrictBean getDistrictBean()
	{
		return this.districtBean;
	}

	public String getId()
	{
		return this.id;
	}

	public String getIdentity()
	{
		return this.identity;
	}

	public String getName()
	{
		return this.name;
	}

	public String getSex()
	{
		return this.sex;
	}

	public void setAddress( String address )
	{
		this.address = address;
	}

	public void setBirthDate( Date birthDate )
	{
		this.birthDate = birthDate;
	}

	public void setDistrictBean( DistrictBean districtBean )
	{
		this.districtBean = districtBean;
	}

	public void setId( String id )
	{
		this.id = id;
	}

	public void setIdentity( String identity )
	{
		this.identity = identity;
	}

	public void setName( String name )
	{
		this.name = name;
	}

	public void setSex( String sex )
	{
		this.sex = sex;
	}

}